<%--
  Created by IntelliJ IDEA.
  User: yjc
  Date: 2020/10/26
  Time: 22:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="/layui/css/layui.css"/>
    <script type="text/javascript" src="/layui/layui.js"></script>
    <script type="text/javascript" src="/js/jquery-3.2.1.js"></script>
</head>

<body>
<button type="button" class="layui-btn" id="upload1">
    <i class="layui-icon">&#xe67c;</i>上传图片
</button>
<%--单个文件上传后回显--%>
<img src="" id="img1">
<%--加载模块--%>
<script type="text/javascript">
    layui.use('upload',function () {
        var upload=layui.upload;
        //1.完成上传的设置
        upload.render({
            elem:'#upload1',
            url:'uploadFile1',
            //上传成功的到返回器的结果
            done:function(resp){
               /* console.info(resp)*/
                $("#img1").prop("src","/upload/"+resp.path);
            }
        })
    })


</script>

</body>
</html>
